<template>
	<view class="content">
		<view class="title">
			子组件B
		</view>
		<view class="b-box">
			comA组件传进来的值：
			<text class="intent-text-box">{{result}}</text>
		</view>
		<view class="b-box" style="margin: 10rpx;">
			<text>回传值：{{backVal}}</text>
			<input type="text" v-model="callbackValue" style="color: yellow;" />
			<button @click="sendOutside()" size="mini">回传</button>
		</view>
	</view>
</template>

<script>
	export default {
		name: "compB",
		props: {
			result: {
				type: String,
				default: ''
			}
		},
		data() {
			return {
				backVal: "user"
			};
		},
		methods: {
			sendOutside() {
				console.log("sendOutside----");
				this.$emit('sendOutside', this.backVal)
			}
		}
	}
</script>

<style>
	.content {
		background: #7be6a6;
		padding: 20rpx;
		margin: 20rpx 0;
	}

	.button {
		background: #fff;
		border: 1px solid #ccc;
		padding: 10rpx 20rpx;
		margin-top: 10rpx;
	}
</style>